package io.tim.timongodb;

/**
 * TimongoDB 实例下的数据库
 *
 * @author zhangnan
 * @date 2017年4月12日
 *
 */

public class Database {
	
	private String instanceName;

	private String dbName;

	public Database(String instanceName, String dbName) {
		this.instanceName = instanceName;
		this.dbName = dbName;
	}

	public String getDbName() {
		return dbName;
	}

	public void setDbName(String dbName) {
		this.dbName = dbName;
	}

	public String getInstanceName() {
		return instanceName;
	}

	public void setInstanceName(String instanceName) {
		this.instanceName = instanceName;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((dbName == null) ? 0 : dbName.hashCode());
		result = prime * result + ((instanceName == null) ? 0 : instanceName.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Database other = (Database) obj;
		if (dbName == null) {
			if (other.dbName != null)
				return false;
		} else if (!dbName.equals(other.dbName))
			return false;
		if (instanceName == null) {
			if (other.instanceName != null)
				return false;
		} else if (!instanceName.equals(other.instanceName))
			return false;
		return true;
	}

	@Override
	public String toString() {
		return "Database [instanceName=" + instanceName + ", dbName=" + dbName + "]";
	}
	
}
